<?php require _APP_PATH_ . '/system/platform/resource/common_inc_header.tpl.php';?>

<span class="layui-breadcrumb">
    <a href="<?php echo url( _MODULE_NAME_ . '/admin.index/index');?>"><?php echo $GLOBALS['config']['module']['name'];?></a>
    <a><cite>文章分类</cite></a>
</span>

<div class="layui-tab layui-tab-brief">
    <ul class="layui-tab-title">
        <li class="layui-this"><a href="<?php echo url([ _MODULE_NAME_ ,'admin.articlesort','index']);?>">文章分类</a></li>
    </ul>
</div>

<div class="layui-form toolbar">
    <div class="layui-form-item">
        <div class="layui-inline">
            <a class="layui-btn" href="<?php echo url([ _MODULE_NAME_ ,'admin/articlesort','article_sort_add']);?>">
                <i class="layui-icon layui-icon-add-1"></i>新增
            </a>
        </div>
        <div class="layui-inline" style="float:right">
             <form action="<?php echo url([_MODULE_NAME_,'admin/articlesort','index']);?>" method="get">
             <input type="hidden" name="<?php echo $GLOBALS['config']['var_pathinfo']; ?>" value="<?php echo $_REQUEST[ $GLOBALS['config']['var_pathinfo'] ]; ?>">
                <label class="layui-form-label w-auto"> &nbsp; </label>
                <div class="layui-input-inline mr0">
                    <input name="keyword" value="<?php echo isset($_REQUEST['keyword'])?$_REQUEST['keyword']:'';?>" class="layui-input" type="text" placeholder="输入分类名称关键字"  lay-verify="required" />
                </div>
                <button class="layui-btn icon-btn" lay-filter="formSubSearchTbBas" lay-submit type="submit">
                    <i class="layui-icon">&#xe615;</i>搜索
                </button>
            </form>
        </div>         
    </div>
</div>

<table class="layui-table" id="tableTbBas" lay-filter="tableTbBas">
    <thead>
        <tr>
            <th>ID</th>
            <th>分类名称</th>
            <th>图片</th>
            <th>显示位置</th>
            <th>排序</th>
            <th>状态</th>
            <th>操作</th>
        </tr> 
    </thead>
    <tbody>
        <?php
        foreach($rs as $row){
        ?>
        <tr>
            <td ><?php echo $row['sort_id'];?></td>
            <td style="text-align: left;padding-left:50px;">
                <?php 
                for($i=2;$i<substr_count($row['parent_path'],',');$i++){ echo '&nbsp; &nbsp; ├ ';}                
                ?>
                <a href="<?php echo url([_MODULE_NAME_,'admin/article','index'],['sort_id'=>$row['sort_id']]);?>" title="点击查看分类下文章"><?php echo $row['sort_name'];?></a>                
            </td>
            <td ><img src="<?php echo $row['sort_img'];?>" loading="lazy"></td>
            <td ><?php echo $row['place'];?></td>
            <td ><?php echo $row['list_order'];?></td>
            <td ><?php if($row['status']==1){ ?><span class="layui-btn layui-btn-xs">启用</span><?php }else{ ?><span class="layui-btn layui-btn-xs  layui-btn-primary">禁用</span><?php } ?></td>
            <td >
                <a href="<?php echo url([ _MODULE_NAME_ ,'admin/articlesort','article_sort_edit'],['id'=>$row['sort_id']]);?>"><button class="layui-btn layui-btn-normal layui-btn-sm"><i class="layui-icon layui-icon-edit"></i>修改</button></a>
                <?php if($row['is_sys']==1){ ?>
                    <a class="layui-btn layui-btn-disabled layui-btn-sm"><i class="layui-icon layui-icon-delete"></i>删除</a>
                <?php }else{ ?>
					<a href="<?php echo url([ _MODULE_NAME_ ,'admin/articlesort','article_sort_delete'],['id'=>$row['sort_id']]);?>" onclick="return rj_confirm('你确定删除么？', this.href );"><button class="layui-btn layui-btn-danger layui-btn-sm"><i class="layui-icon layui-icon-delete"></i>删除</button></a>
                <?php } ?>
            </td>
        </tr>
        <?php
        }
        ?>
    </tbody>
</table>
<div class="layui-box layui-laypage layui-laypage-default" style="display:block;text-align:center;margin-top:10px">
    <?php echo $page->url_nav_easy();?>
</div>

<?php require _APP_PATH_ . '/system/platform/resource/common_inc_footer.tpl.php';?>